<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <title>DOM 渲染是否异步</title>
</head>

<body>
  <div id="d">默认文本</div>
  <script>
    d.onclick = function () {
      console.log('开始更改DOM')
      this.innerHTML = "往div里添加的新文本";//更改一个节点
      console.log('DOM 更改完毕')
      document.body.appendChild(document.createElement("input"));//插入一个节点
      for (var i = 0; i < 10000000000; i++);
      console.log('xxxx')
    }

setTimeout(() => {
  console.log('定时器的回调逻辑')
}, 0)
console.log('代码的最后位置')
  </script>
</body>
</html>